package yyy.ab.modules.quartz.entity;

import java.math.BigInteger;

/**
 * 任务触发器类
 */
public class QuartzJob {
    /**
     * 任务名称
     */
    private String jobName;
    /**
     * 任务所在组
     */
    private String jobGroup;
    /**
     * 任务类名
     */
    private String jobClassName;
    /**
     * 触发器名称
     */
    private String triggerName;
    /**
     * 触发器所在组
     */
    private String triggerGroup;
    /**
     * 触发间隔（毫秒）
     */
    private BigInteger repeatInterval = BigInteger.ZERO;
    /**
     * 触发次数
     */
    private BigInteger timesTriggered = BigInteger.ZERO;
    /**
     * 表达式
     */
    private String cronExpression;
    /**
     * 时区
     */
    private String timeZoneId;
    /**
     * 触发器状态
     */
    private String triggerState;
    /**
     * 触发器状态名称
     */
    private String triggerStateName;

    private byte[] jobData;

    private String jobTitle;

    private String parameter;

    private String description;

    public String getJobName() {
        return jobName;
    }

    public void setJobName(String jobName) {
        this.jobName = jobName;
    }

    public String getJobGroup() {
        return jobGroup;
    }

    public void setJobGroup(String jobGroup) {
        this.jobGroup = jobGroup;
    }

    public String getJobClassName() {
        return jobClassName;
    }

    public void setJobClassName(String jobClassName) {
        this.jobClassName = jobClassName;
    }

    public String getTriggerName() {
        return triggerName;
    }

    public void setTriggerName(String triggerName) {
        this.triggerName = triggerName;
    }

    public String getTriggerGroup() {
        return triggerGroup;
    }

    public void setTriggerGroup(String triggerGroup) {
        this.triggerGroup = triggerGroup;
    }

    public BigInteger getRepeatInterval() {
        return repeatInterval;
    }

    public void setRepeatInterval(BigInteger repeatInterval) {
        this.repeatInterval = repeatInterval;
    }

    public BigInteger getTimesTriggered() {
        return timesTriggered;
    }

    public void setTimesTriggered(BigInteger timesTriggered) {
        this.timesTriggered = timesTriggered;
    }

    public String getCronExpression() {
        return cronExpression;
    }

    public void setCronExpression(String cronExpression) {
        this.cronExpression = cronExpression;
    }

    public String getTimeZoneId() {
        return timeZoneId;
    }

    public void setTimeZoneId(String timeZoneId) {
        this.timeZoneId = timeZoneId;
    }

    public String getTriggerState() {
        return triggerState;
    }

    public void setTriggerState(String triggerState) {
        this.triggerState = triggerState;
    }

    public byte[] getJobData() {
        return jobData;
    }

    public void setJobData(byte[] jobData) {
        this.jobData = jobData;
    }

    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getParameter() {
        return parameter;
    }

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getTriggerStateName() {
        if (triggerState == null) {
            return "无";
        } else if (triggerState.equals("DELETED")) {
            return "无";
        } else if (triggerState.equals("COMPLETE")) {
            return "完成";
        } else if (triggerState.equals("PAUSED")) {
            return "暂停";
        } else if (triggerState.equals("PAUSED_BLOCKED")) {
            return "暂停";
        } else if (triggerState.equals("ERROR")) {
            return "错误";
        } else {
            return triggerState.equals("BLOCKED") ? "阻塞" : "正常";
        }
    }

    public void setTriggerStateName(String triggerStateName) {
        this.triggerStateName = triggerStateName;
    }
}
